package cn.vc.content.feign.clients.article;

import cn.vc.basicmodule.entity.Result;
import cn.vc.content.entity.article.Article;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;

@FeignClient(name = "content-service", path = "/content/article")
public interface ArticleClient {

    /**
     * 发布文章
     * @param title 文章标题
     * @param intro 文章简介
     * @param content 文章内容
     * @return
     */
    @PostMapping("/publish")
    Result<?> publish(@RequestParam String title, @RequestParam String intro, /*@RequestParam String communitiesId,*/
                             @RequestParam String coverUrl,
                             @RequestBody String content) throws IOException;
    /**
     * 审核通过
     */
    @PostMapping("/audit/{id}")
    void passTheAudit(@PathVariable("id") Long id);



    /**
     * <h2>查询所有草稿</h2>
     * @return
     */
    @GetMapping("/1")
    List<Article> selectDraft();
    /**
     * <h2>通过ID查询草稿</h2>
     * @return
     */
    @GetMapping("/1/{id}")
    Result<?> selectDraftById(@PathVariable("id") String id);
    /**
     * <h2>查询所有文章</h2>
     * @return
     */
    @GetMapping("/2")
    Result<List<Article>> selectArticleAll();
    /**
     * 通过ID查询文章
     * @return
     */
    @GetMapping("/2/{id}")
    Result<?> selectSaveById(@PathVariable("id") Long id);

}
